from django.http import HttpResponse
from django.shortcuts import render
import requests
from weixin.settings import accessToken
import json

# Create your views here.
def index(request):
    r = requests.get('http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&day=0&city=&dfc=1&charset=utf-8')

    c = {'content':r.content,"message":"hello world"}
    return render(request, template_name='edu/index.html', context=c)

def server_ip(request):
    r = requests.get('https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token={access_token}'.format(access_token=accessToken))

    c = {'content':"ss","message":"hello world"}
    c = r.content
    return HttpResponse(c,content_type='application/json')
